//
//  DealerSelectController.m
//  YiBaoStore
//
//  Created by 毛云河 on 2018/12/26.
//  Copyright © 2018 小河. All rights reserved.
//

#import "DealerSelectController.h"

@interface DealerSelectController ()

@end

@implementation DealerSelectController

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    self.bgNavView.hidden = YES;
    self.view.backgroundColor =[UIColor lightGrayColor];
    self.titleArray = @[@"已上架商品",@"上架审核"];
    DealerController *dealer = [[DealerController alloc]init];
    AuditController *audit = [[AuditController alloc]init];
    self.controllerArray = @[dealer,audit];
    self.myBtnIndexBlock = ^(NSInteger btnIndex)
    {
        NSLog(@"********%ld",btnIndex);
        if (btnIndex == 0)
        {
            //自营已上架
            USER_DEFAULTS_SAVE(@"1", @"itemState");//储存1，表示搜索自营商品 已上架
        }
        else if (btnIndex == 1)
        {
            //自营审核中
            USER_DEFAULTS_SAVE(@"2", @"itemState");//储存2，表示搜索自营商品 审核中
        }
    };
    
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changToDealer:) name:@"changeToDealerNotific" object:nil];
}

- (void)changToDealer:(NSNotification *)notifiction
{
    NSLog(@"***______******%f",self.myScrollView.contentOffset.x);
    if (self.myScrollView.contentOffset.x > 0.0f) {
        //自营审核中
        USER_DEFAULTS_SAVE(@"2", @"itemState");//储存2，表示搜索自营商品 审核中
    }
    else {
        //自营已上架
        USER_DEFAULTS_SAVE(@"1", @"itemState");//储存1，表示搜索自营商品 已上架
    }
}



@end
